package com.zx.map.dao.impl;

import com.zx.map.dao.MerchantCertificateInfoDao;
import com.zx.map.dao.mapper.MerchantCertificateInfoMapper;
import com.zx.map.dao.mapper.MerchantInfoMapper;
import com.zx.map.dao.model.MerchantCertificateInfo;
import com.zx.map.dao.model.MerchantCertificateInfoExample;
import com.zx.map.dao.model.MerchantInfo;
import com.zx.map.dao.model.MerchantInfoExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: ������
 * Date: 15-5-12
 * Time: ����14:12
 * ������Ϣ�����ݲ���-ʵ��
 */
@Component("MerchantCertificateInfoDao")
public class MerchantCertificateInfoImpl implements MerchantCertificateInfoDao {

    @Autowired
    private MerchantInfoMapper merchantInfoMapper;
    @Autowired
    private MerchantCertificateInfoMapper merchantCertificateInfoMapper;
	public void addMerchantInfo(MerchantInfo merchantInfo)
			throws DataAccessException {
		    int column = merchantInfoMapper.insert(merchantInfo);
	        if (column != 1) {
	            throw new RuntimeException("");
	        }
	}
	public void updateMerchantInfo(MerchantInfo merchantInfo)
			throws DataAccessException {
		    int column = merchantInfoMapper.updateByPrimaryKeySelective(merchantInfo);
	        if (column != 1) {
	            throw new RuntimeException("");
	        }
		
	}
	public int countMerchantInfo(MerchantInfoExample example)
			throws DataAccessException {
		    return merchantInfoMapper.countByExample(example);
	}
	public List<MerchantInfo> getUser(MerchantInfoExample example)
			throws DataAccessException {
		return merchantInfoMapper.selectByExample(example);
	}
	public List<MerchantInfo> getUserListByPage(int pageSize, int pageBegin,
			MerchantInfoExample example) throws DataAccessException {
		 return merchantInfoMapper.selectByPage(pageSize,pageBegin,example);
	}
	public MerchantInfo getMerchantInfoById(String id)
			throws DataAccessException {
		return merchantInfoMapper.selectByPrimaryKey(id);
	}
	public List<MerchantInfo> getMerchantInfo(MerchantInfoExample example)
			throws DataAccessException {
		return merchantInfoMapper.selectByExample(example);
	}
	public void addMerchantCertificateInfo(MerchantCertificateInfo merchantCertificateInfo)
			throws DataAccessException {
		 	int column = merchantCertificateInfoMapper.insert(merchantCertificateInfo);
	        if (column != 1) {
	            throw new RuntimeException("");
	        }
		
	}
	public MerchantCertificateInfo getMerchantCertificateInfoById(String id)
			throws DataAccessException {
		return merchantCertificateInfoMapper.selectByPrimaryKey(id);
	}
	public void updateMerchantCertificateInfo(
			MerchantCertificateInfo merchantCertificateInfo) throws DataAccessException {
		int column = merchantCertificateInfoMapper.updateByPrimaryKeySelective(merchantCertificateInfo);
        if (column != 1) {
            throw new RuntimeException("");
        }
	}
	public List<MerchantCertificateInfo> getListByExample(MerchantCertificateInfoExample example)
			throws DataAccessException {
		return merchantCertificateInfoMapper.selectByExample(example);
	}
	public void queryMerchantCertificateInfo(
			MerchantCertificateInfo merchantCertificateInfo)
			throws DataAccessException {
		
	}
    
}
